package com.atung.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;

import com.atung.model.BusCompanion;
import com.atung.provider.BusCompanionProvider;

@Mapper
public interface BusCompanionDAO {

	/**
	 * 新增同行人员
	 * @param busCompanion
	 * @return
	 */
	@InsertProvider(type=BusCompanionProvider.class,method="insterCompanion")
	Boolean insertCompanion(BusCompanion busCompanion);
	
	/**
	 * 修改同行人
	 * @param busCompanion
	 * @return
	 */
	@UpdateProvider(type=BusCompanionProvider.class,method="updateCompanion")
	Boolean updateCompanion(BusCompanion busCompanion);
	/**
	 * 删除同行人
	 * @param id
	 * @return
	 */
	@Delete("update bus_companion set is_delect=1 where id=#{id}")
	Boolean deleteCompanion(@Param("id")Long id);
	/**
	 * 查询同行人
	 * @param openId
	 * @return
	 */
	@Select("select * from bus_companion where  is_delect=0 and open_id=#{openId} order by id")
	List<BusCompanion> selectCompanionAndOpenId(@Param("openId")String openId);
}
